
const BASE_URL = 'http://dan.fuliaoxx.com'
const request = (config) => {
	if(!config.showlod){
		uni.showLoading({
			title:''
		})
	}
	
	return new Promise((resolve, reject) => {
		uni.request({
			url: BASE_URL + config.url,
			method: config.method || 'GET',
			data: config.data || {},
			header: { // "Bearer " +  Authorization
				"Token":uni.getStorageSync('addrtoken')||""
			},
			success: (res) => {
				uni.hideLoading()
				if (res.data.code == 401) {
					uni.showToast({
						title: res.data.msg,
						icon: 'none'
					})
				}
				resolve(res)
			},
			fail: (err) => {
				// uni.hideLoading()
				reject(err)
			}
		})
	})
};
// 上传

export {
	request,
	BASE_URL
};
